package com.lisn.activityresultsapi

import android.content.Intent
import android.os.Bundle
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import com.lisn.activityresultsapi.R

class SecondActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_second)
        val secondButton = findViewById<Button>(R.id.second_button)
        secondButton.setOnClickListener {
            val intent = Intent()
            intent.putExtra("data", "data from com.lisn.activityresultsapi.SecondActivity")
            setResult(RESULT_OK, intent)
            finish()
        }
    }

}